
<%@ page import="uumoi.Brand; uumoi.Collection" %>
<!DOCTYPE html>
<html>
	<head>
		<meta name="layout" content="main">
		<title><g:message code="collection.title"/></title>
	</head>
	<body>
        <g:render template="../fragments/userinfo"/>

        <div id="selectors">
            <div id="selector-brands">
                <h5><g:message code="collection.brand.selection"/></h5>

                <g:if test="${brands?.size() > 1}">
                    <ol>
                        <g:each in="${brands}" var="b">
                            <li><g:link action="index" params="[brandId: b.id]" class="${session.brand == b.id ? 'selected' : ''}">${b.name}</g:link></li>
                        </g:each>
                    </ol>
                </g:if>
                <g:elseif test="${brands.size() == 1}">
                    ${brands[0].name}
                </g:elseif>
                <g:else>
                    <g:link controller="brand" action="create"><g:message code="brand.create"/></g:link>
                </g:else>
            </div>

            <g:if test="${regions || session.region}">
                <div id="selector-regions">
                    <h5><g:message code="collection.region.selection"/></h5>

                    <g:if test="${regions.size() > 1}">
                        <ol>
                            <g:each in="${regions}" var="r">
                                <li><g:link action="index" params="[regionId: r.id]" class="${session.region == r.id ? 'selected' : ''}">${r.name}</g:link></li>
                            </g:each>
                        </ol>
                    </g:if>
                    <g:elseif test="${regions.size() == 1}">
                        ${regions[0].name}
                    </g:elseif>
                    <g:else>
                        <g:link controller="region" action="create"><g:message code="region.create"/></g:link>
                    </g:else>
                </div>
            </g:if>

            <g:if test="${channels || session.channel}">
                <div id="selector-channels">
                    <h5><g:message code="collection.channel.selection"/></h5>

                    <g:if test="${channels.size() > 1}">
                        <ol>
                            <g:each in="${channels}" var="c">
                                <li><g:link action="index" params="[channelId: c.id]" class="${session.channel == c.id ? 'selected' : ''}">${c.name}</g:link></li>
                            </g:each>
                        </ol>
                    </g:if>
                    <g:elseif test="${channels.size() == 1}">
                        ${channels[0].name}
                    </g:elseif>
                    <g:else>
                        <g:link controller="channel" action="create"><g:message code="channel.create"/></g:link>
                    </g:else>
                </div>
            </g:if>
        </div>

        <div id="collections">
            <ol>
                <g:each in="${activeCollections}" var="collection">
                    <li><g:link action="index" params="[collectionId: collection.id]">${collection.name}</g:link></li>
                </g:each>
            </ol>
        </div>

        <div id="collection-images">
            <g:render template="../fragments/fileupload"/>
        </div>
	</body>
</html>
